
<template>
    <div class="bodys">
        <div class="box-center">
            <div class="image-box">
                <img class="image" src="/etyyicon.png">
                <span class="title">需求工单小程序</span>
            </div>
            <button id="goWeiXin" @click="getScheme()">
                打开小程序
            </button>
        </div>
    </div>
</template>


<script>
    import wx from "weixin-js-sdk"
    import { postAction,getAction } from '@/api/manage'

    export default {
        name: "wxjump",
        data() {
            return {
                list: [],
                wxConfig:undefined,
                url:{
                    getwxMsg:"/web/api/Login/getWxMsg"
                }
            }
        },
        mounted() {

        },
        methods: {
            getScheme(){
                postAction(this.url.getwxMsg, {})
                    .then(res => {
                        console.log("data:",res.result.wx)
                        // let di1= res.result.wx
                        let scheme = res.result.scheme
                        window.location.href = scheme;
                        // wx.config({
                        //     debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印
                        //     appId: di1.appId, // 必填，公众号的唯一标识
                        //     timestamp: di1.timestamp, // 必填，生成签名的时间戳
                        //     nonceStr: di1.nonceStr, // 必填，生成签名的随机串
                        //     signature: di1.signature,// 必填，签名
                        //     jsApiList: ['getLocation','openTagList'], // 必填，需要使用的JS接口列表
                        //     openTagList: ['wx-open-launch-weapp'] // 可选，需要使用的开放标签列表，例如['wx-open-launch-app']
                        // });
                        wx.ready(function () {
                            console.log('config is success')
                        })
                        wx.error(function (err) {
                            console.log(err)
                        })
                    })
            },

        }
    }

</script>
<style scoped>
    #goWeiXin {
        width: 200px;
        height: 40px;
        border-radius: 20px;
        background: linear-gradient(90.00deg, #5049e5 0%, #6d49e5 100%);

        outline: none;
        border: none;
        /* border-radius: 4px; */
        color: #fff;
        font-size: 16px;
        font-weight: 500;
        margin-top: 76px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .box-center {
        text-align: center;
        width: 100%;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        align-items: center;
        flex-direction: column;
        justify-content: center;
    }
    .image-box{
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    .title{
        margin-top: 20px;
        font-size: 20px;
        font-weight: 600;
        color:#333333;
    }

    .image {
        width: 96px;
    }
    .wx-image{
        width: 30px;
        height: 30px;
    }
    .bodys{
        width: 100%;
        height: 100vh;
        background: #E9EAF8;
    }
</style>
